<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>axios+vue</title>

<style type="text/css">
td {
	border: 1px solid aqua;
}
</style>
</head>

<body>
		<div id="app">

		<form name="regFrom">
			<table align="center" width="500" border="0" cellpadding="0">
				<tr>
					<td>adminId</td>
					<td><input name="adminId" v-model="user.adminId" type="text" /></td>
				</tr>
				<tr>
					<td>adminName</td>
					<td><input name="adminName" v-model="user.adminName"
						type="text" /></td>
				</tr>
				<tr>
					<td>password:</td>
					<td><input name="password" v-model="user.password" type="text" /></td>
				</tr>
				<tr>
					<td colspan="2"><input type="button" value="提交注册"
						@click="regUser"></td>
				</tr>
			</table>
		</form>
	</div>
	<!-- 官网提供的 axios 在线地址 -->
	<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
	<!-- 开发环境版本，包含了有帮助的命令行警告 -->
	<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
	<script>
		var app = new Vue({
			el : "#app",
			data : {
				user : {
					"adminId" : 1,
					"adminName" : "root",
					"password" : "123456"
				} 
			},
			methods : {
				regUser : function() {
					var that = this;
					console.log(that.$data.user);
				    axios.post('http://localhost:8088/spring-demo/admin/add2.do',that.$data.user).then(res=>{
					    console.log(res.data)
					}).catch(Error=>{
					    console.log(Error)})
				}
			}
		})
	</script>
</body>

</html>